<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div style="width: 100%; display: flex; flex-direction: column; height: 100vh;">
    <div style="display: flex; align-items: center; padding: 1px 15px;">
      <!-- 左侧新建按钮 -->
      <el-button class="idoo-details-add">新建</el-button>
      <!-- 右侧信息区域：垂直展示 -->
      <div style="display: flex; flex-direction: column; margin-left: 10px;">
        <span style="font-size: 15px;">员工</span>
        <div style="display: flex; align-items: center; font-size: 14px; margin-top: 4px;">
          <span class="sub-title">{{ staffText }}</span>
          <el-tooltip content="保存" placement="top">
            <el-icon class="hover-icon" style="margin-left: 10px;">
              <StarFilled />
            </el-icon>
          </el-tooltip>
        </div>
      </div>
    </div>
    <!-- 带阴影的分割线 -->
    <div class="divider"></div>
    <!-- 后续内容区域：背景色为淡灰色，填满剩余区域 -->
    <div class="content-section">
      <div style="display: flex; width: 100%;">
        <!-- 左侧：无阴影的Card，占整体宽度的65%，用于表单的详情数据 -->
        <el-card style="box-shadow: none; width: 65%; margin-right: 10px;">
          <el-form :model="staffBasicForm" style="width: 100%;">
            <el-form-item label="" prop="name">
              <el-input v-model="staffBasicForm.name"
                style="font-size: 30px; height: 60px; line-height: 60px; width: 70%; padding: 10px;"
                class="idoo-details-input" placeholder="员工姓名"></el-input>
            </el-form-item>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="工作电子邮件">
                  <el-input v-model="staffBasicForm.email" style="width: 100%;" class="idoo-details-input"
                    placeholder="例如：johndoe@example.com"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="部门">
                  <el-input v-model="staffBasicForm.department" style="width: 100%;" class="idoo-details-input"
                    placeholder=""></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="工作地点">
                  <el-input v-model="staffBasicForm.jobAddress" style="width: 100%;" class="idoo-details-input"
                    placeholder=""></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="办公手机">
                  <el-input v-model="staffBasicForm.phone" style="width: 100%;" class="idoo-details-input"
                    placeholder=""></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="工作岗位">
                  <el-input v-model="staffBasicForm.job" style="width: 100%;" class="idoo-details-input"
                    placeholder="例如：销售经理"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="最近考核日期">
                  <el-input v-model="staffBasicForm.assensmentDate" style="width: 100%;"
                    class="idoo-details-input"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="直属领导">
                  <el-input v-model="staffBasicForm.manager" style="width: 100%;" class="idoo-details-input"
                    placeholder="例如：销售经理"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
              </el-col>
            </el-row>

            <el-row :gutter="20" style="margin-top: 20px;">
              <!-- 将标签页移到这里，表单下方 -->
              <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
                <el-tab-pane label="简历" name="first">User</el-tab-pane>
                <el-tab-pane label="工作信息" name="second">Config</el-tab-pane>
              </el-tabs>
            </el-row>
          </el-form>
        </el-card>

        <!-- 右侧：修改记录区域，保持背景色 -->
        <div style="width: 35%; padding: 10px;">
          <!-- 修改记录内容 -->
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { StarFilled } from '@element-plus/icons-vue';
import type { TabsPaneContext } from 'element-plus'

const route = useRoute();

// 定义表单数据类型
interface StaffBasicForm {
  name?: string;
  email?: string;
  jobAddress?: string;
  phone?: string;
  job?: string;
  assensmentDate?: string;
  manager?: string;
  department?: string;
}

// 初始化表单数据
const staffBasicForm = ref<StaffBasicForm>({
  name: '',
  email: '',
  jobAddress: '',
  phone: '',
  job: '',
  assensmentDate: '',
  manager: '',
  department: ''
});

//获取路由参数  ，当前界面编辑需要传入 员工id 员工名称
const staffText = computed(() => {
  return route.params.id ? (route.params.staffName || '') : '新建';
});
const activeName = ref('first')
const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab, event)
}
</script>
<style scoped>
:deep(.el-input__inner) {
  --el-input-inner-height: none;
}

:deep(.el-card__body) {
  padding: 1% !important;
  justify-content: unset !important;
}

.hover-icon {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.hover-icon:hover {
  transform: translateY(-2px);
}

.sub-title {
  font-size: 14px;
  color: #666;
}

.divider {
  width: 100%;
  height: 1px;
  background-color: #ccc;
  margin-top: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-section {
  flex: 1;
  width: 100%;
  padding: 15px;
  background-color: #f5f5f5;
  box-sizing: border-box;
}
.demo-tabs > .el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
}

.demo-tabs {
  position: relative;
  width: 100%;
}

:deep(.el-tabs__nav-wrap::after) {
  position: absolute;
  content: '';
  width: 100%;
  height: 2px;
  background-color: var(--el-border-color-light);
  bottom: 0;
  left: 0;
  z-index: 1;
}
:deep(.el-tabs__nav.is-top) {
  margin-left:10px
}

:deep(.el-tabs__header) {
  width: 100%;
  margin-bottom: 0;
}

:deep(.el-tabs__nav-wrap) {
  width: 100%;
}
</style>
